<?php

class Webtaculous_Log extends Zend_Log {
	
	public function log($message, $priority, $extras = null) {
		global $app_root;
		$backtrace = debug_backtrace();
		for($i=0;$i<count($backtrace);$i++) {
			if (isset($backtrace[$i]['class']) and $backtrace[$i]['class'] == 'Zend_Log' and $backtrace[$i]['function'] == '__call') {
				$file = $backtrace[$i+1]['file'];
				$line = $backtrace[$i+1]['line'];
				$file = preg_replace('#^' . preg_quote($app_root, '#') . '#', '', $file);
				$message .= " ({$file}#{$line})";
			}
		}
		return parent::log($message, $priority, $extras);
	}
}
